import VueRouter from 'vue-router'

//引入组件
import Index from '../pages'
import Home from '../pages/home/home'
import Login from '../pages/login/login'
import Register from '../pages/register/register'
import Center from '../pages/center/center'
import Messages from '../pages/messages/list'
import News from '../pages/news/news-list'
import NewsDetail from '../pages/news/news-detail'
import yonghuList from '../pages/yonghu/list'
import yonghuDetail from '../pages/yonghu/detail'
import yonghuAdd from '../pages/yonghu/add'
import yishengList from '../pages/yisheng/list'
import yishengDetail from '../pages/yisheng/detail'
import yishengAdd from '../pages/yisheng/add'
import keshiList from '../pages/keshi/list'
import keshiDetail from '../pages/keshi/detail'
import keshiAdd from '../pages/keshi/add'
import menzhenyishengList from '../pages/menzhenyisheng/list'
import menzhenyishengDetail from '../pages/menzhenyisheng/detail'
import menzhenyishengAdd from '../pages/menzhenyisheng/add'
import yuyueguahaoList from '../pages/yuyueguahao/list'
import yuyueguahaoDetail from '../pages/yuyueguahao/detail'
import yuyueguahaoAdd from '../pages/yuyueguahao/add'
import yuyuequxiaoList from '../pages/yuyuequxiao/list'
import yuyuequxiaoDetail from '../pages/yuyuequxiao/detail'
import yuyuequxiaoAdd from '../pages/yuyuequxiao/add'
import huanzhebinganList from '../pages/huanzhebingan/list'
import huanzhebinganDetail from '../pages/huanzhebingan/detail'
import huanzhebinganAdd from '../pages/huanzhebingan/add'
import yaopinxinxiList from '../pages/yaopinxinxi/list'
import yaopinxinxiDetail from '../pages/yaopinxinxi/detail'
import yaopinxinxiAdd from '../pages/yaopinxinxi/add'
import huanzhechufangList from '../pages/huanzhechufang/list'
import huanzhechufangDetail from '../pages/huanzhechufang/detail'
import huanzhechufangAdd from '../pages/huanzhechufang/add'
import menzhenshoufeiList from '../pages/menzhenshoufei/list'
import menzhenshoufeiDetail from '../pages/menzhenshoufei/detail'
import menzhenshoufeiAdd from '../pages/menzhenshoufei/add'
import menzhenquyaoList from '../pages/menzhenquyao/list'
import menzhenquyaoDetail from '../pages/menzhenquyao/detail'
import menzhenquyaoAdd from '../pages/menzhenquyao/add'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

//配置路由
export default new VueRouter({
	routes:[
		{
      path: '/',
      redirect: '/index/home'
    },
		{
			path: '/index',
			component: Index,
			children:[
				{
					path: 'home',
					component: Home
				},
				{
					path: 'center',
					component: Center,
				},
				{
					path: 'messages',
					component: Messages
				},
				{
					path: 'news',
					component: News
				},
				{
					path: 'newsDetail',
					component: NewsDetail
				},
				{
					path: 'yonghu',
					component: yonghuList
				},
				{
					path: 'yonghuDetail',
					component: yonghuDetail
				},
				{
					path: 'yonghuAdd',
					component: yonghuAdd
				},
				{
					path: 'yisheng',
					component: yishengList
				},
				{
					path: 'yishengDetail',
					component: yishengDetail
				},
				{
					path: 'yishengAdd',
					component: yishengAdd
				},
				{
					path: 'keshi',
					component: keshiList
				},
				{
					path: 'keshiDetail',
					component: keshiDetail
				},
				{
					path: 'keshiAdd',
					component: keshiAdd
				},
				{
					path: 'menzhenyisheng',
					component: menzhenyishengList
				},
				{
					path: 'menzhenyishengDetail',
					component: menzhenyishengDetail
				},
				{
					path: 'menzhenyishengAdd',
					component: menzhenyishengAdd
				},
				{
					path: 'yuyueguahao',
					component: yuyueguahaoList
				},
				{
					path: 'yuyueguahaoDetail',
					component: yuyueguahaoDetail
				},
				{
					path: 'yuyueguahaoAdd',
					component: yuyueguahaoAdd
				},
				{
					path: 'yuyuequxiao',
					component: yuyuequxiaoList
				},
				{
					path: 'yuyuequxiaoDetail',
					component: yuyuequxiaoDetail
				},
				{
					path: 'yuyuequxiaoAdd',
					component: yuyuequxiaoAdd
				},
				{
					path: 'huanzhebingan',
					component: huanzhebinganList
				},
				{
					path: 'huanzhebinganDetail',
					component: huanzhebinganDetail
				},
				{
					path: 'huanzhebinganAdd',
					component: huanzhebinganAdd
				},
				{
					path: 'yaopinxinxi',
					component: yaopinxinxiList
				},
				{
					path: 'yaopinxinxiDetail',
					component: yaopinxinxiDetail
				},
				{
					path: 'yaopinxinxiAdd',
					component: yaopinxinxiAdd
				},
				{
					path: 'huanzhechufang',
					component: huanzhechufangList
				},
				{
					path: 'huanzhechufangDetail',
					component: huanzhechufangDetail
				},
				{
					path: 'huanzhechufangAdd',
					component: huanzhechufangAdd
				},
				{
					path: 'menzhenshoufei',
					component: menzhenshoufeiList
				},
				{
					path: 'menzhenshoufeiDetail',
					component: menzhenshoufeiDetail
				},
				{
					path: 'menzhenshoufeiAdd',
					component: menzhenshoufeiAdd
				},
				{
					path: 'menzhenquyao',
					component: menzhenquyaoList
				},
				{
					path: 'menzhenquyaoDetail',
					component: menzhenquyaoDetail
				},
				{
					path: 'menzhenquyaoAdd',
					component: menzhenquyaoAdd
				},
			]
		},
		{
			path: '/login',
			component: Login
		},
		{
			path: '/register',
			component: Register
		},
	]
})
